summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/btm/btm_system_core.cpp
blob: 42628badbe27e83d43e74b6775cceafc9cb62d23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later

#include "common/logging/log.h"
#include "core/hle/service/btm/btm_system_core.h"
#include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/server_manager.h"
#include "core/hle/service/service.h"

namespace Service::BTM {

IBtmSystemCore::IBtmSystemCore(Core::System& system_)
    : ServiceFramework{system_, "IBtmSystemCore"} {
    // clang-format off
        static const FunctionInfo functions[] = {
            {0, C<&IBtmSystemCore::StartGamepadPairing>, "StartGamepadPairing"},
            {1, C<&IBtmSystemCore::CancelGamepadPairing>, "CancelGamepadPairing"},
            {2, nullptr, "ClearGamepadPairingDatabase"},
            {3, nullptr, "GetPairedGamepadCount"},
            {4, nullptr, "EnableRadio"},
            {5, nullptr, "DisableRadio"},
            {6, C<&IBtmSystemCore::IsRadioEnabled>, "IsRadioEnabled"},
            {7, nullptr, "AcquireRadioEvent"},
            {8, nullptr, "AcquireGamepadPairingEvent"},
            {9, nullptr, "IsGamepadPairingStarted"},
            {10, nullptr, "StartAudioDeviceDiscovery"},
            {11, nullptr, "StopAudioDeviceDiscovery"},
            {12, nullptr, "IsDiscoveryingAudioDevice"},
            {13, nullptr, "GetDiscoveredAudioDevice"},
            {14, nullptr, "AcquireAudioDeviceConnectionEvent"},
            {15, nullptr, "ConnectAudioDevice"},
            {16, nullptr, "IsConnectingAudioDevice"},
            {17, C<&IBtmSystemCore::GetConnectedAudioDevices>, "GetConnectedAudioDevices"},
            {18, nullptr, "DisconnectAudioDevice"},
            {19, nullptr, "AcquirePairedAudioDeviceInfoChangedEvent"},
            {20, C<&IBtmSystemCore::GetPairedAudioDevices>, "GetPairedAudioDevices"},
            {21, nullptr, "RemoveAudioDevicePairing"},
            {22, C<&IBtmSystemCore::RequestAudioDeviceConnectionRejection>, "RequestAudioDeviceConnectionRejection"},
            {23, C<&IBtmSystemCore::CancelAudioDeviceConnectionRejection>, "CancelAudioDeviceConnectionRejection"}
        };
    // clang-format on

    RegisterHandlers(functions);
}

IBtmSystemCore::~IBtmSystemCore() = default;

Result IBtmSystemCore::StartGamepadPairing() {
    LOG_WARNING(Service_BTM, "(STUBBED) called");
    R_SUCCEED();
}

Result IBtmSystemCore::CancelGamepadPairing() {
    LOG_WARNING(Service_BTM, "(STUBBED) called");
    R_SUCCEED();
}

Result IBtmSystemCore::IsRadioEnabled(Out<bool> out_is_enabled) {
    LOG_DEBUG(Service_BTM, "(STUBBED) called"); // Spams a lot when controller applet is running

    *out_is_enabled = true;
    R_SUCCEED();
}

Result IBtmSystemCore::GetConnectedAudioDevices(
    Out<s32> out_count, OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices) {
    LOG_WARNING(Service_BTM, "(STUBBED) called");

    *out_count = 0;
    R_SUCCEED();
}

Result IBtmSystemCore::GetPairedAudioDevices(
    Out<s32> out_count, OutArray<std::array<u8, 0xFF>, BufferAttr_HipcPointer> out_audio_devices) {
    LOG_WARNING(Service_BTM, "(STUBBED) called");

    *out_count = 0;
    R_SUCCEED();
}

Result IBtmSystemCore::RequestAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) {
    LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid);
    R_SUCCEED();
}

Result IBtmSystemCore::CancelAudioDeviceConnectionRejection(ClientAppletResourceUserId aruid) {
    LOG_WARNING(Service_BTM, "(STUBBED) called, applet_resource_user_id={}", aruid.pid);
    R_SUCCEED();
}

} // namespace Service::BTM